<template>
	<view class="uni_box login">
		<navbar title='实名认证' backgroundColor='#010101'>
		</navbar>
		<view class="content">
			<view class="listitem">
				<input class="iteminput" type="text" v-model="name" placeholder="请输入姓名">
			</view>
			<view class="listitem">
				<input class="iteminput" type="text" v-model="id_card" placeholder="请输入身份证号">
			</view>
			<view class="listitem" v-if="$store.state.info.show_phone">
				<input class="iteminput" type="text" v-model="$store.state.info.show_phone" disabled placeholder="请输入手机号">
			</view>
			<view class="miao">
				购买前请完成实名认证，实名认证完成后，您的提现账户将与此实名信息进行绑定，请知晓！
			</view>
		</view>
		<view class="botbtn">
			<!-- nochou 结束class -->
			<view class="btns" v-if="$store.state.info.is_realname">
				已认证
			</view>
			<view class="btns" v-else @click="realnamePost">
				确定
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: "",
				id_card: "",
				phone:''
			};
		},
		async onLoad() {
			console.log(this.$store.state.info)
			if (this.$store.state.info.is_realname) {
				let {
					realname
				} = await this.$u.api.realname();
				this.name = realname.name;
				this.id_card = realname.id_card;
			}
		},
		methods: {
			async realnamePost() {
				await this.$u.api.realnamePost({
					name: this.name,
					id_card: this.id_card
				});
				this.$u.toast("实名认证成功");
				setTimeout(() => {
					// uni.switchTab({
					// 	url: '/pages/tabbar/my'
					// })
					uni.navigateTo({
						url:'/pages/my/index'
					})
				}, 1000);
			},
			backTo() {
				uni.navigateBack()
			},
			router(url) {
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style scoped lang="scss">
  page{
  	background-color: #010101;
  }
  .content{
	  padding: 30rpx;
	  .listitem{
	  	width: 100%;
	  	height: 92rpx;
	  	background: #222222;
	  	border-radius: 8rpx;
	  	padding: 0 20rpx;
	  	margin-bottom: 36rpx;
	  	display: flex;
	  	flex-direction: row;
	  	align-items: center;
	  	.qu{
	  		font-size: 28rpx;
	  		font-family: PingFang SC-Regular, PingFang SC;
	  		font-weight: 400;
	  		color: #FFFFFF;
	  		margin-right: 20rpx;
	  	}
	  	.iteminput{
	  		font-size: 28rpx;
	  		color: #fff;
	  		// padding: 0 20rpx;
	  		width: 70%;
	  	}
	  	.fayan{
	  		margin-left: auto;
	  		font-size: 28rpx;
	  		font-family: PingFang SC-Regular, PingFang SC;
	  		font-weight: 400;
	  		color: #73FAB5;
	  	}
	  	.yan{
	  		margin-left: auto;
	  		width: 28rpx;
	  		height: 40rpx;
	  	}
	  }
	  .miao{
		  margin: 30rpx 50rpx;
		  font-size: 28rpx;
		  font-family: PingFang SC-Regular, PingFang SC;
		  font-weight: 400;
		  color: #999999;
	  }
  }
  // 底部按钮开始
  .botbtn{
  	width: 100%;
  	position: fixed;
  	bottom: 0;
  	height: 120rpx;
  	background: #252525;
  	opacity: 1;
  	display: flex;
  	align-items: center;
  	padding: 30rpx;
  	.btns{
  		width: 100%;
  		height: 88rpx;
  		background: linear-gradient(90deg, #9394F3 0%, #82E7CB 54%, #22FC94 100%);
  		border-radius: 8rpx;
  		opacity: 1;
  		display: flex;
  		align-items: center;
  		justify-content: center;
  		font-size: 32rpx;
  		font-family: PingFang SC-Bold, PingFang SC;
  		font-weight: bold;
  		color: #232323;
  	}
  	.nochou{
  		background: #999999;
  		font-weight: bold;
  		color: #232323;
  	}
  }
  //底部按钮结束
</style>
